package objects.UpdateStarItem 
{
	import feathers.controls.Label;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import starling.display.Button;
	import starling.display.Image;
	import starling.display.MovieClip;
	import starling.display.Sprite;
	import starling.filters.ColorMatrixFilter;
	import starling.text.TextField;
	import starling.text.TextFieldAutoSize;
	import starling.filters.BlurFilter;
	
	/**
	/**
	 * ...
	 * @author 
	 */
	public class itemInUpdateStar extends Sprite 
	{
		public var m_star:int;
		public var m_textY:int;
		public var m_info:TextField;
		public var background:Image;
		public var starImage:Image;
		public var m_text:TextField;
		public var m_sprite:Sprite;
		public var m_textStar:TextField;	
		public var m_stage:int;
		public var m_image:MovieClip;
		public function itemInUpdateStar(_star:int, base:String,_sprite:Sprite,_index:int) 
		{
			m_sprite = _sprite;
			m_image = new MovieClip(Assets.getSpriteBook().getTextures(base), 14);
			m_image.currentFrame = _index;
			this.addChild(m_image);
			m_text= new TextField(0, 0, "", "MyFontName", 15, 0x000000);
			m_textY = 20;
			m_star = _star;
			m_info = new TextField(150, 150, "", "MyFontName", 15, 0x000000);
			m_textStar = new TextField(20, 35, "", "MyFontName", 20, 0x220000);
			m_textStar.bold = true;
			m_info.hAlign = "left";
			m_info.vAlign = "top";
			m_sprite.addChild(m_info);
			m_info.visible = false;
			background = new Image(Assets.getTexture("background2"));
			starImage = new Image(Assets.getTexture("SaoItem"));
			background.alpha = 0.7;
			m_info.addChild(background);
			this.addChild(starImage);
			this.addChild(m_textStar);
			starImage.x += this.width-50;
			starImage.y += this.height - 10;
			m_textStar.x = starImage.x+5;
			m_textStar.y = starImage.y-5;
		}
		public function addText(_text:String,color:String,size:int,kc:int):void
		{
			var text:TextField = new TextField(500, 500, _text, "MyFontName", size, 0xffffff);
			text.color = uint(color);
			text.hAlign = "left";
			text.vAlign = "top";
			text.y += kc;
			m_text.text += _text;
			m_info.addChild(text);
			
		}
		public function refresh():void
		{
			m_info.removeChildren();
			background.scaleX = 1;
			background.scaleY = 1;
			m_info.addChild(background);
			m_text.text = "";
		}
		public function setScale(x:int):void
		{
			background.scaleX = (m_text.textBounds.width-x) / background.width;
			background.scaleY = m_text.textBounds.height  / background.height;
		}
		public function showStar():void
		{
			m_textStar.text = m_star + "";
		}
		
		public function release():void {
			background = null;
			this.removeChildren();
			m_info.removeChildren();
			m_sprite.removeChild(m_info);
			
		}
		
	}

}